home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-21 | 2.1 KB | 82 lines | [TEXT/ttxt] |
- ---<<<
- in module Autofinder
-
- class DetailWindow (Window)
- instance variables
- media
- parentDoc
- end
-
- method init self {class DetailWindow} #rest args #key media: parentDoc: ->
- (
- apply nextMethod self type:@palette args
- self.media := media
- self.parentDoc := parentDoc
-
- local backgrnd := media["Detail Background"]
- -- Due to Win '95 bug, window ad to be adjusted
- backgrnd.x := 1; backgrnd.y := 1
- append self backgrnd
-
- self
- )
-
- method printWindow self {class DetailWindow} ->
- (
- local surface, scaleFactor, myTransform, oldRate
-
- -- Suspend thread swapping so we can guarantee that the
- -- contents of the Window don't change
- threadCriticalUp()
-
- -- Create a PrinterSurface
- surface := new PrinterSurface
-
- -- We calculate the ratio of our width and height to
- -- that of the Printer. The minimum of the two ratios
- -- is what we'll use to scale our bitmap.
- scaleFactor := min (surface.boundary.width / self.boundary.width) \
- (surface.boundary.height / self.boundary.height)
-
- -- Create a transformation matrix that represents the scaling
- myTransform := mutableCopy identityMatrix
- scale myTransform scaleFactor scaleFactor
-
- -- Display the printer dialog box and see if we should continue
- if (printerDialog surface) do (
- -- Stop the window's clock so we know nothing will change
- oldRate := self.clock.rate
- self.clock.rate := 0
-
- -- Transfer the window's offscreen representation
- -- to the PrinterSurface with appropriate scaling
- transfer surface (snapshot self undefined) \
- surface.boundary myTransform
-
- -- Restart the window's clock
- self.clock.rate := oldRate
-
- -- Flush the document
- flushDocument surface
- )
-
- -- Restart thread swapping
- threadCriticalDown()
- )
-
- -- Specialize the hide method of the palette window to purge objects.
- method hide self {class DetailWindow} ->
- (
- nextMethod self
- bringToFront self.parentDoc.presentedBy
-
- makePurgeable self.media["Detail Background"]
- emptyout self
-
- leaveScene self.parentDoc.detailDocument
- self.parentDoc.detailDocument := undefined
- )
-
- "Compiled mapwin.sx"
- --->>>
-